package org.hibernate;


import org.hibernate.cfg.Configuration;
import org.hibernate.dto.FourWheeler;
import org.hibernate.dto.TwoWheeler;
import org.hibernate.dto.UserDetails;
import org.hibernate.dto.Vehicle;

public class HibernateTest {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
	
		
		UserDetails user = new UserDetails();
		user.setUserName("First user");
		
		Vehicle vehicle = new Vehicle();
		vehicle.setVehicleName("car");
		
		TwoWheeler bike = new TwoWheeler();
		bike.setVehicleName("Bike");
		bike.setSteeringHandle("Bike steering handle");
		
		FourWheeler car = new FourWheeler();
		car.setVehicleName("Porche");
		car.setSteeringWheel("Porche steering wheel");
		
		FourWheeler car2 = new FourWheeler();
		car2.setVehicleName("Porche");
		car2.setSteeringWheel("Porche steering wheel");
		
		SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
		Session session = sessionFactory.openSession();
		session.beginTransaction();
		session.save(vehicle);
		session.save(bike);
		session.save(car);
		session.save(car2);
	
		session.getTransaction().commit();
		session.close();
	}

}
